<template>
  <div class="cart-list">
    <!-- 占位符，防止scroll会取消Item开头的margin -->
    <div class="station"/>
    <cart-list-item v-for="(item, index) in cartList" :goods="item" :key="index"
                    @checkedClick="checkClick(index)" @decClick="decClick(index)"
                    @incClick="incClick(index)"/>
  </div>
</template>

<script>
  import Scroll from 'components/common/scroll/Scroll'
  import CartListItem from 'views/cart/childCart/CartListItem'

  export default {
    name: "CartList",
    components: {
      CartListItem,
      Scroll
    },
    props: {
      cartList: {
        type: Array,
        default() {
          return []
        }
      }
    },
    methods: {
      checkClick(index) {
        this.$emit('checkedClick', index)
      },
      decClick(index) {
        this.$emit('decClick', index)
      },
      incClick(index) {
        this.$emit('incClick', index)
      }
    }
  }
</script>

<style scoped>
  .station {
    height: 1px;
  }
</style>